fix: expose __queryClient only in dev, un-double-format TVL, type-check tests, seed farm e2e via network (#471, #472, #473, #475) - #503
Merged
ritaifeoluwa merged 25 commits intoSep 25, 2026
Conversation
…uction Never leak the QueryClient in a production bundle; dev-only check keeps pnpm dev e2e (lock-unlock-lifecycle) working without NEXT_PUBLIC_E2E.
…double-format getPlatformStats already returns totalValueLocked as a localized currency string (e.g. $3,500); formatCredits turned it into $0.0M XLM.
…/ credit velocity
Drop **/*.test.{ts,tsx} from tsconfig exclude so test files are
type-checked; keep vitest/playwright configs and tests/**, e2e/**.
…twork-guard tests
…ver env Set NEXT_PUBLIC_FACTORY_CONTRACT_ID and NEXT_PUBLIC_SIMULATION_ACCOUNT so getFactoryPools succeeds under the Playwright dev server.
…ueryClient Mock soroban-testnet RPC (get_pools/get_user_position XDR, sendTransaction flips position state) instead of injecting into window.__queryClient; stateful lock/unlock flows with fixed clock for countdown tests.
…ixture FarmPosition.lockedAt is ms (unlockAvailableAt = lockedAt + lockPeriodSeconds*1000); seconds values rendered 'Unlocked' instantly.
❌ Deploy Preview for spiffy-melomakarona-eb1e8a failed.
|
❌ Deploy Preview for smart-drop failed.
|
|
@SweetBoy-eth Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four fixes across E2E hygiene, stats rendering, and TypeScript coverage.
closes #474 — Never expose
window.__queryClientin productionContextProvidernow assignswindow.__queryClientonly whenprocess.env.NODE_ENV !== 'production'. The QueryClient is no longerleaked in production bundles (previously gated only on
NEXT_PUBLIC_E2E). Dev-server E2E (lock-unlock-lifecycle) keepsworking since
pnpm devruns withNODE_ENV=development.closes #476 — Stop double-formatting Total Value Locked
getPlatformStats()already returnstotalValueLockedas a localizedcurrency string (
"$3,500").PlatformStatswas piping that throughformatCredits, rendering$0.0M XLM. The TVL stat now rendersstats.tvldirectly;formatCreditsremains in use for the creditvelocity stat (raw credit units).
tvl: '$3,500', raw credit-velocity number)PlatformStatssnapshotcloses #477 — Type-check test files
Removed
**/*.test.ts(x)fromtsconfig.jsonexcludeso tests arecovered by
pnpm typecheck(configs ande2e/**,tests/**stayexcluded). Fixed every error this surfaced:
loading.tsx: widenSkeletonBar.wto accept responsive objectsNavbar.tsx: add missinguseEffectimportuseLockFlow.ts: remove duplicatestepRefdeclarationfarmStore.ts: exportFarmStoretype for selector typinguseSorobanEvents, useSorobanQuery, validateEnv tests
Buffer.allocinstead ofnew Uint8Array().fill()for StrKey seeds(feeBumpGuard, soroban, feebump, history tests)
process.envwhere strict types required itcloses #475 — Seed
farm.spec.tsat the network layerRewrote
e2e/farm.spec.tsto remove allwindow.__queryClientdependency (per issue). Pool and position data are now seeded by
mocking the Soroban RPC HTTP layer:
simulateTransactionreturns pre-computed XDR forget_pools/get_user_position, function-specific auth for lock/unlocksendTransactionflips a statefulempty ⇄ lockedposition so thepost-mutation QueryClient invalidation refetches updated data
getLatestLedgerintentionally omitsheaderXdr/metadataXdrsovelocity/events polling fails closed without hitting the real network
locked_atfixture uses epoch ms to matchFarmPosition(
unlockAvailableAt = lockedAt + lockPeriodSeconds * 1000)e2e/playwright.config.tssetsNEXT_PUBLIC_FACTORY_CONTRACT_IDandNEXT_PUBLIC_SIMULATION_ACCOUNTinwebServer.envsogetFactoryPools/ simulation calls resolve under the dev serverVerification
npx tsc --noEmit→ 0 errors (was 9 pre-existing + all newlysurfaced test-file errors)
playwright e2e/farm.spec.ts→ 5/5 passing (connect, deposit,countdown, fast-forward unlock, unlock submit)
playwright --list→ 15 tests / 6 files, no collection errorsuseLeaderboardrace,useSorobanEventsretention) fail identically on baseline
main